package first;


import java.io.BufferedInputStream;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.UnsupportedEncodingException;
import java.sql.Timestamp;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.TreeMap;

public class BugPerDay {
	
	public static void main(String[] args) {
		String filename="D:\\重要文档\\江老师\\bug_priority_data_tianyuan\\Last.txt";
		Map<String, Integer> bugNumbers= new TreeMap<String,Integer>();
		
		File file = new File(filename);   
		BufferedInputStream fis;
		BufferedReader reader=null;
		try {
			fis = new BufferedInputStream(new FileInputStream(file));
			reader = new BufferedReader(new InputStreamReader(fis,"utf-8"),5*1024*1024);
		} catch (UnsupportedEncodingException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (FileNotFoundException e1) {
			// TODO Auto-generated catch block
			e1.printStackTrace();
		} // 用5M的缓冲读取文本文件  
		  
		String line = "";
		
		System.out.println(bugNumbers.get("aaaaaaaaaaaaaaaaa"));
		try {
			while((line = reader.readLine()) != null){
				if(line.trim().startsWith("Time=")){
					String time=line.substring(5,15);
					System.out.println(time);
					
					Integer value = bugNumbers.get(time);
					if(value==null){
						bugNumbers.put(time, 1);
					}else{
						bugNumbers.put(time, value+1);
					}
				}
			}
		}catch (IOException e) {
		// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
		for(String time:bugNumbers.keySet()){
			System.out.println(time+"\t"+bugNumbers.get(time));
		}
	}
}
